package com.sven.idrivingfutureserver.common;

import lombok.ToString;

@ToString
public enum OptCode {

    BINDING(100, "绑定挪车码"),
    UNBINDING(101, "解绑挪车码"),
    SCANNING(102, "扫码"),
    CALLING(103, "打电话"),
    WECHAT(104, "发微信"),
    SMS(105, "发短信"),
    SCAN_QRCODE(106, "被扫码"),
    CHANGE_PHONE_NUMBER(120, "更换手机号"),
    ADD_PLATE_NUMBER(121, "添加车牌号"),
    CHANGE_PLATE_NUMBER(122, "修改车牌号"),
    ;
    final int code;
    final String des;
    OptCode(int code, String des) {
        this.code = code;
        this.des = des;
    }

    public String message() {
        return des;
    }

    public int code() {
        return code;
    }

    public static String getDescByCode(int code) {
        for (OptCode optCode : OptCode.values()) {
            if (optCode.code == code) {
                return optCode.des;
            }
        }
        return "no match OptCode";
    }
}
